package com.fy.tt.entity.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fy.tt.util.JsonUtils;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Table;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import java.util.List;

@Data
@NoArgsConstructor
@Table(name = "bls_semantic")
public class SemanticVo {
    //    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    //    @ApiModelProperty(value = "词汇语义类类名")
    private String className;

    //    @ApiModelProperty(value = "词汇语义代码说明")
    private String codeDescription;

    //    @ApiModelProperty(value = "词汇语义代码")
    private String code;

    //    @ApiModelProperty(value = "词汇语义代码开发用户id列表")
    private List<Long> developerIds;

    //    @ApiModelProperty(value = "所属场景区id（ObjBandID）")
    private Long bandObjId;

    private String bandName;

    //    @ApiModelProperty(value = "词汇id")
    private Long wordId;

    //    @ApiModelProperty(value = "类别：1：名词 2：动词 3：形容词 4：副词 5：数词 6：量词 7：代词 8：叹词  9：拟声词 10：介词 11：连词 12：助词")
    private Long type;

    //    @ApiModelProperty(value = "更新时间（需要更新对应objBandID，bls_parser中words_update_time字段）")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    public SemanticVo(ResultSet rs) {
        try {
            this.id = rs.getLong("id");
            this.className = rs.getString("class_name");
            this.codeDescription = rs.getString("code_description");
            this.code = rs.getString("code");
            this.developerIds = JsonUtils.string2Array(rs.getString("developer_ids"));
            this.bandName = rs.getString("band_name");
            this.bandObjId = rs.getLong("band_obj_id");
            this.wordId = rs.getLong("word_id");
            this.type = rs.getLong("type");
            this.updateTime = rs.getTimestamp("update_time");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }


}
